package com.plate.commom.activiti.controller;

import com.plate.commom.activiti.domain.ActModelEntity;
import com.plate.commom.activiti.domain.ActModelQueryBO;
import com.plate.commom.activiti.service.IMyActModelService;
import com.plate.common.core.result.Result;
import org.activiti.engine.repository.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName MyActivitiModelController
 * @Description TODO
 * @Author jiaxd
 * @Date 2023年12月09日 12:53
 * @Version 1.0
 */

@RestController
@RequestMapping("/act/model")
public class MyActModelController {

    @Autowired
    private IMyActModelService actModelService;

    @PostMapping("/list")
    public Result list(@RequestBody ActModelQueryBO queryBO) {
        Map<String, Object> page = actModelService.Page(queryBO);
        return Result.SUCCESS(page);
    }

    @PostMapping("save")
    public Result save(@RequestBody ActModelEntity entity) {
        try {
            Model save = actModelService.save(entity);
            return Result.SUCCESS();
        } catch (Exception e) {
            return Result.FAIL(e.getMessage());
        }

    }




}
